#!/user/bin/env python3
# -*- coding: utf-8 -*-
"""
--------------------------------------
    Author:     JiChao_Song
    Date  :     2022/2/22 16:37
    Desc  :     ParamsCommonVo参数列表类
--------------------------------------
"""
from common.exceptions import MsPioneerException


class ParamsCommonVo:

    def __init__(self, dataKey: str, dataValue: str):
        self.dataKey = dataKey
        self.dataValue = dataValue


class ParamsCommonListVo:

    def __init__(self, params: list[dict]):
        self.params = params

    def getParamsDict(self) -> dict:
        paramsDict = {}
        for i in self.params:
            i = ParamsCommonVo(**i)
            if i.dataKey and i.dataKey != '':
                paramsDict[i.dataKey] = i.dataValue

        return paramsDict


if __name__ == '__main__':
    data1 = [
        {'dataKey': '1', 'dataValue': '1-1'},
        {'dataKey': '2', 'dataValue': '2-1'},
        {'dataKey': '3', 'dataValue': '3-1'},
        {'dataKey': None, 'dataValue': '4-1'},
    ]

    print(ParamsCommonListVo(params = data1).getParamsDict())
